<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="imports.jsp" %>
<html>

<head>
<script type="text/javascript">
	function submitform()
{
    document.forms["myform"].submit();
}

function confirmation(id,name) {
	var answer = confirm("Voulez-vous supprimer "+name+" ?");
	if (answer){
		alert(name+" supprimé");
		window.location = "DeleteArticle?articleId="+id+"";
		
	}
	
}
	
</script>
	
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" media="screen" type="text/css" title="style" href="style.css"/>
	<title>${article.title}</title>
</head>
<body>
<div id="wrapper">
	<div id="header">
		<div id="logo">
		<h1>e-commerce de livres</h1>
		
			
		</div>
		
	</div>
	<!-- end #header -->
	<div id="menu">
			<jsp:include page="header.jsp"/>
	</div>
	<!-- end #menu -->
	<div id="page">
	<div id="page-bgtop">
	<div id="page-bgbtm">
	
	
		<div id="content">
			<div class="post">
				<h2 class="title">${article.title}</h2>
				<div class="entry">
					<c:if test="${sessionUser != null}">
						<c:if test="${sessionUser.role == 'ADMIN'}">
							<br>
				 			<a href="EditArticle?articleId=${article.id}"><img width="16px" src="images/style/modifier.png"></a>&nbsp;&nbsp;&nbsp;
				 			<a onclick="confirmation('${article.id}','${article.title}')" href=""><img src="images/style/supprimer.png"></a><br/>
				 		</c:if>
				 		</c:if>
					<table  style="width: 100%;padding-top: 15px;" >
			
				<tr>
					<td style="width: 200px">
					
					<img src=<%=request.getContextPath() + "/images/style/noimage.gif"%> width="200 px">
					
					</td>
					<td style ="padding-left:10px;float:left;">
				 		Auteur: ${article.author}<br/>
				 		Editeur: ${article.editor}<br/>
				 		Genre(s) : 
				 		<c:forEach var="genre" items="${article.genres}" varStatus="genreCount">
				 			<c:if test="${genreCount.count > 1}">
				 				/ 
				 			</c:if>
				 			${genre}
				 		</c:forEach><br/>
				 		Année: ${article.year}<br/>
				 		${article.numberOfPages} Pages<br/>
				 		
				 		Résumé:<br/>
				 		${article.summary}
				 	</td></tr><tr><td></td>
				 	<td style="float:right;">
				 		
				 		<fmt:formatNumber value="${article.price}" type="currency" currencySymbol="&euro;"/><br/>
				 		
				 			<c:choose>
						<c:when test="${article.stock > 0}">
						<form id="myform" method="post" action="AddToCart">
				 			<input type="hidden" name="articleId" value="${article.id}">
				 			<div class="purchase">
				 			<a  href="javascript:submitform();"></a>
								</div>
				 		</form>
							
						</c:when>
						<c:otherwise>
				
							<div style="color: red;">Indisponible</div>
							
							
						</c:otherwise>
					</c:choose>
				 			
				 			
				 		

				 	</td>
				 </tr>
			
		</table>
					
					
					</div>
					
					
			</div>
		
		<div style="clear: both;">&nbsp;</div>
		</div>
		<!-- end #content -->
		<div id="sidebar">
			<ul>
				<jsp:include page="admin.jsp"/>
				<jsp:include page="categories.jsp"/>
			</ul>
		</div>
		<!-- end #sidebar -->
		<div style="clear: both;">&nbsp;</div>
	</div>
	</div>
	</div>
	<!-- end #page -->
</div>
	<div id="footer">
		<p>Copyright (c) 2011. All rights reserved.</p>
	</div>
	<!-- end #footer -->
</body>
</html>





